#include<iostream>
using namespace std;
class Solution {
public:
    string convert(string s, int numRows) 
    {
        if (numRows == 1)return s;
        string ans = "";
        for (int i = 0; i < numRows; i++)
        {
            int t = i, c = 0; 
            while (t < s.length())
            {
                ans += s[t];
                if ((c % 2 && i != 0) || i == numRows - 1)
                {
                    t += i * 2 ;
                }
                else
                {
                    t += (numRows - i) * 2 - 2;
                }
                c++;
            }
  
        }
        return ans;
    }
};
int main()
{
    Solution s;
    string str = "G";
    int n = 1;
    cout << s.convert(str, n) << endl;
}